/*
 * archmage
 * version: 0.1.0
 * Port.java
 * Copyright by codefish, zeyu@ufl.edu
 * 2012
 */
package pfctrller;

/**
 * @author codefish
 *
 */
public class Port {
	
	protected long DPID;
	protected int portNum;
	
	/**
	 * Simple Constructor
	 * @param DPID
	 * @param portNum
	 */
	public Port(long DPID, int portNum) {
		super();
		this.DPID = DPID;
		this.portNum = portNum;
	}

	//
	// Getter and Setter
	//
	
	/**
	 * @return the DPID
	 */
	public long getDPID() {
		return DPID;
	}

	/**
	 * @param DPID the DPID to set
	 */
	public void setDPID(long DPID) {
		this.DPID = DPID;
	}

	/**
	 * @return the portNum
	 */
	public int getPortNum() {
		return portNum;
	}

	/**
	 * @param portNum the portNum to set
	 */
	public void setPortNum(int portNum) {
		this.portNum = portNum;
	}

    // 
    // Objects
    // 
	
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result;
        result = prime * result + portNum;
        result = prime * result + (int) (DPID ^ (DPID >>> 32));
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (getClass() != obj.getClass()) return false;
        Port other = (Port) obj;
        if (portNum != other.portNum) return false;
        if (DPID != other.DPID) return false;
        return true;
    }

    @Override
    public String toString() {
        return "Port [DPID=" + DPID + ", port=" + portNum + "]";
    }
}
